package com.itheima.d1_algorithm.CaseTest;

import java.util.Arrays;

/**
 * @ClassName MaoPao
 * @Author 16799
 * @Date 2025/7/21 11:08
 * @Version 1.0
 * @Description TODO
 * 冒泡排序
 **/
public class MaoPao {
    public static void main(String[] args) {
        int arr[] = {12,4,122,44,324,5};
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < (arr.length - i - 1); j++) {
                if (arr[j]>arr[j+1]){
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        System.out.println("排序完成之后： ");
        System.out.println(Arrays.toString(arr));
    }
}
